package com.yanqu.road.entity.activity.carptrip;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.carptrip.config.*;
import com.yanqu.road.entity.activity.climbtower.ClimbTowerRoleInfo;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class CarpTripConfig {

    private ActivityInfo activityInfo;

    private List<CarpTripLevelInfo> levelInfoList;

    private List<CarpTripTemplateInfo> templateInfoList;

    private List<CarpTripEventInfo> eventInfoList;

    private List<CarpTripRoleInfo> roleInfoList;

    private List<CarpTripAbilityInfo> towerInfoList;

    private List<CarpTripPvpTopInfo> pvpTopList;

    private List<CarpTripDragonUpInfo> dragonUpInfoList;

    private List<CarpTripDrawUpInfo> drawUpInfoList;

    private List<CarpTripPicInfo> picInfoList;

    //缓存，总层数
    private int totalCellNum = 0;

    private int auraMax = 30;
    private int auraGetCd = 1800;
    private int auraGetNum = 1;
    private int auraCostNum = 1;
    private int playerStrengthBegin = 40;
    private int drawScoreBase = 200;
    private int towerMaxFloor = 1052;

    private int addAuraItemId = 123024;
    private int scoreItemId = 101828;
    private int expItemId = 123021;
    private int strengthItemId = 123022;
    private int auraItemId = 123023;
    //鱼籽道具
    private int yuZiItemId = 123048;

    private int skillUpNum = 6;

    //boss额外实力增幅（千分比）
    List<Integer> bossExParamList;

    //翻转配置
    List<Integer> overturnList;

    private int drawTenLimit;

    List<Integer> drawWeightList;

    private int DRAW_ISBIG;
    private int DRAW_BIG_PRO;

    private int CARPTRIP_DRAW_NOTICE_CONDITION;
    /**
     * 获取当前层
     * @param passId 阶段
     * @param cell 层
     * @return
     */
    public CarpTripCell getCell(int passId, int cell) {
        if(passId <= 0){
            return null;
        }
        if(cell < 0){
            return null;
        }
        for (CarpTripLevelInfo levelInfo : levelInfoList) {
            if(levelInfo.getId() != passId){
                continue;
            }
            if(cell >= levelInfo.getCellList().size()){
                return null;
            }
            return levelInfo.getCellList().get(cell);
        }
        return null;
    }

    /**
     * 获取下一层
     * @param passId 阶段
     * @param cell 层
     * @return
     */
    public CarpTripCell getNextCell(int passId, int cell) {
        if(passId <= 0){
            return levelInfoList.get(0).getCellList().get(0);
        }
        CarpTripLevelInfo next = null;
        for (int i = 0; i < levelInfoList.size(); i++) {
            CarpTripLevelInfo levelInfo = levelInfoList.get(i);
            if (levelInfo.getId() != passId) {
                continue;
            }
            if (cell + 1 < levelInfo.getCellList().size()){
                return levelInfo.getCellList().get(cell + 1);
            }
            if (i + 1 < levelInfoList.size()){
                next = levelInfoList.get(i + 1);
            }
            if(next == null){
                return null;
            }
            return next.getCellList().get(0);
        }
        return null;
    }


    public CarpTripTemplateInfo getCarpTripTemplateInfo(List<CarpTripTemplateInfo> list, int templateId){
        if(list != null){
            for (CarpTripTemplateInfo templateInfo : list) {
                if(templateId == templateInfo.getId()){
                    return templateInfo;
                }
            }
        }
        if(this.templateInfoList != null){
            for (CarpTripTemplateInfo templateInfo : this.templateInfoList) {
                if(templateId == templateInfo.getId()){
                    return templateInfo;
                }
            }
        }
        return null;
    }

    public CarpTripEventInfo getEventInfoByTypes(int type, int id){
        for (CarpTripEventInfo eventInfo : eventInfoList) {
            if(eventInfo.getType() == type && id == eventInfo.getId()){
                return eventInfo;
            }
        }
        return null;
    }

    public List<CarpTripEventInfo> getEventInfoByType(int type){
        List<CarpTripEventInfo> list = new ArrayList<>();
        for (CarpTripEventInfo eventInfo : eventInfoList) {
            if(eventInfo.getType() == type){
                list.add(eventInfo);
            }
        }
        return list;
    }

    public CarpTripDrawUpInfo getCarpTripDrawUpInfo(int lv){
        for (CarpTripDrawUpInfo drawUpInfo : drawUpInfoList) {
            if(drawUpInfo.getLevel() == lv){
                return drawUpInfo;
            }
        }
        return null;
    }

    /**
     * 根据检验获取角色等级
     * @param exp 经验
     * @return
     */
    public CarpTripRoleInfo getCarpTripRoleInfo(BigInteger exp){
        BigInteger need = BigInteger.ZERO;
        CarpTripRoleInfo role = null;
        for (CarpTripRoleInfo roleInfo : roleInfoList) {
            role = roleInfo;
            need = need.add(roleInfo.getExp());
            if(exp.compareTo(need) < 0){
                break;
            }
        }
        return role;
    }

    public CarpTripLevelInfo getCarpTripLevelInfo(int passId){
        for (CarpTripLevelInfo levelInfo : levelInfoList) {
            if(levelInfo.getId() == passId){
                return levelInfo;
            }
        }
        return null;
    }

    public CarpTripAbilityInfo getCarpTripInfo(int id) {
        for (CarpTripAbilityInfo towerInfo : towerInfoList) {
            if(towerInfo.getId() == id){
                return towerInfo;
            }
        }
        return null;
    }

    public CarpTripPvpTopInfo getCarpTripPvpTopInfo(int cellId){
        for (CarpTripPvpTopInfo pvpTopInfo : pvpTopList) {
            if(pvpTopInfo.getCellNum() == cellId){
                return pvpTopInfo;
            }
        }
        return null;
    }

    public CarpTripDragonUpInfo getCarpTripDragonUpInfo(int id){
        for (CarpTripDragonUpInfo dragonUpInfo : dragonUpInfoList) {
            if(dragonUpInfo.getId() == id){
                return dragonUpInfo;
            }
        }
        return null;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public List<CarpTripLevelInfo> getLevelInfoList() {
        return levelInfoList;
    }

    public void setLevelInfoList(List<CarpTripLevelInfo> levelInfoList) {
        this.levelInfoList = levelInfoList;
    }

    public List<CarpTripTemplateInfo> getTemplateInfoList() {
        return templateInfoList;
    }

    public void setTemplateInfoList(List<CarpTripTemplateInfo> templateInfoList) {
        this.templateInfoList = templateInfoList;
    }

    public List<CarpTripEventInfo> getEventInfoList() {
        return eventInfoList;
    }

    public void setEventInfoList(List<CarpTripEventInfo> eventInfoList) {
        this.eventInfoList = eventInfoList;
    }

    public List<CarpTripRoleInfo> getRoleInfoList() {
        return roleInfoList;
    }

    public void setRoleInfoList(List<CarpTripRoleInfo> roleInfoList) {
        this.roleInfoList = roleInfoList;
    }

    public List<CarpTripAbilityInfo> getTowerInfoList() {
        return towerInfoList;
    }

    public void setTowerInfoList(List<CarpTripAbilityInfo> towerInfoList) {
        this.towerInfoList = towerInfoList;
    }

    public int getAuraMax() {
        return auraMax;
    }

    public void setAuraMax(int auraMax) {
        this.auraMax = auraMax;
    }

    public int getAuraGetCd() {
        return auraGetCd;
    }

    public void setAuraGetCd(int auraGetCd) {
        this.auraGetCd = auraGetCd;
    }

    public int getAuraGetNum() {
        return auraGetNum;
    }

    public void setAuraGetNum(int auraGetNum) {
        this.auraGetNum = auraGetNum;
    }

    public int getAuraCostNum() {
        return auraCostNum;
    }

    public void setAuraCostNum(int auraCostNum) {
        this.auraCostNum = auraCostNum;
    }

    public int getPlayerStrengthBegin() {
        return playerStrengthBegin;
    }

    public void setPlayerStrengthBegin(int playerStrengthBegin) {
        this.playerStrengthBegin = playerStrengthBegin;
    }

    public int getDrawScoreBase() {
        return drawScoreBase;
    }

    public void setDrawScoreBase(int drawScoreBase) {
        this.drawScoreBase = drawScoreBase;
    }

    public List<Integer> getBossExParamList() {
        return bossExParamList;
    }

    public void setBossExParamList(List<Integer> bossExParamList) {
        this.bossExParamList = bossExParamList;
    }

    public int getAddAuraItemId() {
        return addAuraItemId;
    }

    public void setAddAuraItemId(int addAuraItemId) {
        this.addAuraItemId = addAuraItemId;
    }

    public int getScoreItemId() {
        return scoreItemId;
    }

    public void setScoreItemId(int scoreItemId) {
        this.scoreItemId = scoreItemId;
    }

    public int getExpItemId() {
        return expItemId;
    }

    public void setExpItemId(int expItemId) {
        this.expItemId = expItemId;
    }

    public int getStrengthItemId() {
        return strengthItemId;
    }

    public void setStrengthItemId(int strengthItemId) {
        this.strengthItemId = strengthItemId;
    }

    public int getAuraItemId() {
        return auraItemId;
    }

    public void setAuraItemId(int auraItemId) {
        this.auraItemId = auraItemId;
    }

    public int getTotalCellNum() {
        return totalCellNum;
    }

    public void setTotalCellNum(int totalCellNum) {
        this.totalCellNum = totalCellNum;
    }

    public List<CarpTripPvpTopInfo> getPvpTopList() {
        return pvpTopList;
    }

    public void setPvpTopList(List<CarpTripPvpTopInfo> pvpTopList) {
        this.pvpTopList = pvpTopList;
    }

    public List<CarpTripDragonUpInfo> getDragonUpInfoList() {
        return dragonUpInfoList;
    }

    public void setDragonUpInfoList(List<CarpTripDragonUpInfo> dragonUpInfoList) {
        this.dragonUpInfoList = dragonUpInfoList;
    }

    public List<CarpTripDrawUpInfo> getDrawUpInfoList() {
        return drawUpInfoList;
    }

    public void setDrawUpInfoList(List<CarpTripDrawUpInfo> drawUpInfoList) {
        this.drawUpInfoList = drawUpInfoList;
    }

    public int getTowerMaxFloor() {
        return towerMaxFloor;
    }

    public void setTowerMaxFloor(int towerMaxFloor) {
        this.towerMaxFloor = towerMaxFloor;
    }

    public List<Integer> getOverturnList() {
        return overturnList;
    }

    public void setOverturnList(List<Integer> overturnList) {
        this.overturnList = overturnList;
    }

    public int getDrawTenLimit() {
        return drawTenLimit;
    }

    public void setDrawTenLimit(int drawTenLimit) {
        this.drawTenLimit = drawTenLimit;
    }

    public List<Integer> getDrawWeightList() {
        return drawWeightList;
    }

    public void setDrawWeightList(List<Integer> drawWeightList) {
        this.drawWeightList = drawWeightList;
    }

    public int getDRAW_ISBIG() {
        return DRAW_ISBIG;
    }

    public void setDRAW_ISBIG(int DRAW_ISBIG) {
        this.DRAW_ISBIG = DRAW_ISBIG;
    }

    public int getDRAW_BIG_PRO() {
        return DRAW_BIG_PRO;
    }

    public void setDRAW_BIG_PRO(int DRAW_BIG_PRO) {
        this.DRAW_BIG_PRO = DRAW_BIG_PRO;
    }

    public int getSkillUpNum() {
        return skillUpNum;
    }

    public void setSkillUpNum(int skillUpNum) {
        this.skillUpNum = skillUpNum;
    }

    public int getCARPTRIP_DRAW_NOTICE_CONDITION() {
        return CARPTRIP_DRAW_NOTICE_CONDITION;
    }

    public void setCARPTRIP_DRAW_NOTICE_CONDITION(int CARPTRIP_DRAW_NOTICE_CONDITION) {
        this.CARPTRIP_DRAW_NOTICE_CONDITION = CARPTRIP_DRAW_NOTICE_CONDITION;
    }

    public int getYuZiItemId() {
        return yuZiItemId;
    }

    public void setYuZiItemId(int yuZiItemId) {
        this.yuZiItemId = yuZiItemId;
    }

    public List<CarpTripPicInfo> getPicInfoList() {
        return picInfoList;
    }

    public void setPicInfoList(List<CarpTripPicInfo> picInfoList) {
        this.picInfoList = picInfoList;
    }
}
